package com.cn.gmall.weball.controller;

import com.cn.gmall.common.result.Result;
import com.cn.gmall.item.client.ItemFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

@Controller
@SuppressWarnings("all")
public class itemController {
    @Autowired
    private ItemFeignClient itemFeignClient;

    @RequestMapping("{skuId}.html")
    public String getItem(@PathVariable Long skuId, Model model){
        Result<Map<String,Object>> skuById = itemFeignClient.getSkuById(skuId);
      model.addAllAttributes(skuById.getData());
      return "item/item";
    }
}
